import { stringify } from 'qs';
import request from '@/utils/request';

// 角色列表
export async function queryRoleRule(params) {
  if (!params) {
    params = {};
  }
  return request(`/api/role/roles`, {
    method: 'POST',
    body: params,
  });
}

// 新增角色
export async function addRoleRule(params) {
  return request('/api/role/save', {
    method: 'POST',
    body: params,
  });
}

// 获取角色
export async function getRoleById(params) {
  return request(`/api/role/${params.id}`, {
    method: 'POST'
  });
}

// 数据状态控制
export async function enabledControl(params) {
  return request(`/api/role/enabledControl?${stringify(params)}`, {
    method: 'POST'
  });
}
